Repository navigation
The install's own AWS account gets each release's reads with the release, and no alert ever - #789
Merged
Merged
Conversation
…ase, and no alert ever The daily AWS permissions sweep pushed "AWS account X needs N new read-only permissions" for the install's own account: PermissionCheck.install_account was only ever set in tests, so that account was treated like any other. And since every team read there goes through CoderHelmLogReader, that role really fell behind each release. - The check's builder sets install_account from the install's read role, on one-stack installs (INSTALL_READER_KEPT); saved checks are corrected on read. - The sweep sends nothing: the message and its told and claim records are gone. Another account is the AWS page's quiet item with its one-click stack. - The access stack's reader update (lambda/native-reader) creates or updates CoderHelmLogReaderUpdate-release from the running release's update template after each update of the install's stack, daily and on its own create, with read-only groups only. Its role may only do that, only from a release's update template and only through CloudFormation. - The updater asks for the access stack once when it lacks the reader update. - Docs and incident rq_reader_reads_arrive_with_the_release.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A self-hosted install's owner got a push alert saying the install's own AWS account "needs 1 new read-only permission". There were two causes:
PermissionCheck.install_accountis true. The check's builder always wroteinstall_account: false(services/common/src/live/permissions.rs:112). Only tests ever set it, and nothing in production calledlive::aws::in_install_account. So that account was treated like any other: the sweep pushed the alert (passes/aws_permissions.rs:223), and the AWS page offered the one-click update stack.CoderHelmLogReader. That role's stack is separate, and no release updated it.This PR changes three things:
CoderHelmLogReaderUpdate-releasefrom the running release's published update template, with read-only groups only. No person does anything.Changes
live/aws.rs:reader_updates_with_release,updates_with_releaseandINSTALL_READER_KEPT.live/permissions.rs:PermissionCheck::newsetsinstall_accountfrom this process's install role (for_installis the pure form), andcheckgoes through the newcheck_for.install_updatefix now says "Nothing to do: the release brings...".live/aws_account.rs: a check saved before this change is corrected on read.gateway/routes/integrations.rs: the account line now reads "Updates with the release: ... Nothing to do."passes/aws_permissions.rssends nothing. The message, theAWS_PERMS_NOTICEtold and claim records,should_tell,teams_toldandnotify::messages::aws_permissions_updateare removed.lambda/native-reader/handler.py):UPDATE_COMPLETEevent, once a day, and when the access stack is created or updated.CoderHelmLogReaderexists, it creates or updates the one stackCoderHelmLogReaderUpdate-releasefromhttps://coderhelm-public.s3.amazonaws.com/launch/<running version>/coderhelm-log-reader-update.yaml.ROLLBACK_COMPLETEis removed and made again. It never reads the event it is sent.infra/lib/native/access-stack.ts):ReaderRole,Reader,ReaderAfterUpdate,ReaderDaily, twoLambda::Permissions andReaderNow. They are added toACCESS_SHAPE, and their names sit outside the install prefix (CoderHelmReader-<stage>).cloudformation:TemplateUrlmatches a release's update template;CoderHelmLogReader, only whenaws:CalledViais CloudFormation;GetRoleon the reader andGetTemplateSummary, and write its own log.infra/lib/service-env.ts: setsINSTALL_READER_KEPT=1on one-stack installs only. A CLI install keeps the quiet in-app item for its own account.lambda/updater/handler.py): when an existing access stack lacks the reader update,access_computeasks for the access stack once ("adds the reader update"). An install with no access stack gets it through the same one link.self-host/integrations.md: the alert sentence is removed, and the own-account reads now say they come with the release.self-host/security.md: a new "The reader update" section, and the exception added to the role rules.self-host/updates.md.rq_reader_reads_arrive_with_the_release(test and page).The dashboard copy for the install's own account is in CoderHelm/coderhelm (CoderHelm/coderhelm#461).
Verification
cargo fmt --check --all: clean.rustfmt --check --edition 2021 worker/src/passes/incidents/*.rs: clean.cargo clippy -p common -p gateway -p worker --all-targets -- -D warnings: clean.cargo test -p common -p gateway -p worker(the full run): common 2852 passed, worker 2309 passed, gateway 1087 passed, integration tests 2 and 3 passed, 0 failed. This includes the 5 tests of therqincident and the new unit tests.install_account: falseinPermissionCheck),rq::the_checks_own_builder_marks_the_install_accountandrq::the_install_account_shows_nothing_to_dofail. With the fix they pass.python3 -m unittest discover -s lambda/tests: 580 passed. New:test_native_reader.py(12 tests): the stack is created from the release's update template; every declared parameter is given and only read-only groups are on; the next release updates the same stack; already current, no role, busy and a failed first create are each handled; it always answers SUCCESS.test_updater_access.py,ReaderUpdate(4 tests): an access stack without the reader update is asked for once, and never again after.infranpm test: 188 of 188 passed. New:INSTALL_READER_KEPT=1, and a CLI install does not.cfn-lintran as CI does, oninfra/cfn/*.yaml,coderhelm.json,access.jsonandstacks/*.json: clean.node --test selfhost/launch/*.test.mjs: 16 of 16 passed.